<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>影楼管理系统 - 登录</title>
    <link href="https://cdn.bootcss.com/element-ui/2.2.2/theme-chalk/index.css" rel="stylesheet">
</head>

<body style="background: #F3F3F4">
<div style="text-align: center;">
    <h1 style="color: #E6E6E6; font-size: 96px; margin-bottom: 5px;line-height:90px">BK</h1>
    <h3 style="color: #686B6D;margin-top: 0px;">欢迎使用后台管理系统</h3>
</div>
    <div id="loginForm">
        <el-row>
            <el-col :sm="{span:22,offset:0}" :md="{span:20,offset:0}" :lg="{span:6,offset:9}">
                <el-form :model="form" ref="form" label-width="45px">
                    <el-form-item label="账号" prop="username">
                        <el-input v-model.trim="form.username"></el-input>
                    </el-form-item>
                    <el-form-item label="密码" prop="password">
                        <el-input type="password" v-model.trim="form.password"></el-input>
                    </el-form-item>
                    <el-form-item style="text-align: center">
                            <el-button style="text-align: center;" type="primary" size="medium" @click="submit">登 录</el-button>
                    </el-form-item>
                </el-form>
            </el-col>
        </el-row>
</div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.2.2/index.js"></script>
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
<script>
    var vue = new Vue({
        el: '#loginForm',
        data: {
            form: {
                username: '',
                password: ''
            },
        },
        methods: {
            submit() {
                axios({
                    method: 'post',
                    url: '/backsys/login',
                    headers: {
                        'Content-type': 'application/x-www-form-urlencoded'
                    },
                    params: {
                        'username': this.form.username,
                        'password': this.form.password
                    }
                })
                    .then(function (response) {
                        console.log(response)
                        if (response.data.status=='1'){
                            window.location.href = '/bksystem/backsysindex';
                        } else {
                            alert(response.data.message);
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            }
        }
    })
</script>
</html>
